<?php
/**
 * Co2 Controller
 * 
 * @author CRIA Groep 1 <project@markvink.nl>
 * @version 1.0
 * @package controllers
 */
class Co2Controller extends AppController {
	/**
    * @var string Controller name (faster in PHP 4)
    */
	var $name = 'Co2';
	
	/**
    * @var array uses following Models
    */
	var $uses = array('CacheUsage', 'Usagetype');
	
	/**
	 * Function laundriesuser_view
	 * 
	 * Controller action, only accessible by laundry route
	 * @param integer $laundry laundry_id passed by route settings
	 * @param integer $year year
	 * @param integer $month nthm
	 */
	function laundriesuser_view($laundry, $year = null, $month = null) {
		$data = $this->CacheUsage->getData($laundry, $year, $month);
	
		$additivetypes = $this->Usagetype->find('all', array(
			'conditions' => array('Usagetype.type' => 'additive')    
		));
		$energytypes = $this->Usagetype->find('all', array(
			'conditions' => array('Usagetype.type' => 'energy')    
		));
	
		$this->set(compact('data', 'additivetypes', 'energytypes'));	
	}
}